#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    int removeElement(vector<int>& nums, int val) {
        if(nums.empty()){
            return 0;
        }
        sort(nums.begin(),nums.end());
        int index = -1;
        int status = 0;
        for(int i = 0;i<nums.size();++i){
            if(status == 0&&nums[i] == val){
                index = i;
                status=1;
            }
            if(status==1&&nums[i]!=val){
                nums[index] = nums[i];
                index++;
            }
        }
        return index>=0? index:nums.size();
    }
};

int a = 10;
static int b = 10;
static int c;

int main(){
    // Solution S;
    // vector<int> nums = {3,3};
    // cout<<S.removeElement(nums,3)<<endl;
    

}